# ifndef __Colors_H_
# define __Colors_H_

class CColors {
  public:
	CColors () {}
	~CColors () {_DestroyColors ();}

	bool Adjust (HWND _hWnd, const COLORREF * _pDefaultColors, const char ** _strColorNames, size_t _cColors);

	void LoadFromSetting (const char * _strSetting, const COLORREF * _pDefaultColors, size_t _cColors);
	void SaveToSetting (const char * _strSetting) const;

	size_t GetColors () const {return m_colors.size ();}
	COLORREF GetColor (size_t _cColorIdx) const {return m_colors [_cColorIdx].col;}
	void SetColor (size_t _cColorIdx, COLORREF _col);
	void SetColors (const COLORREF * _pColors, size_t _cColors);

	HBRUSH GetBrush (size_t _cColorIdx) const;
	HPEN   GetPen   (size_t _cColorIdx, int _nStyle = PS_SOLID, size_t _cWidth = 1) const;
	
  private:
	struct color_t {
		COLORREF col;
		mutable HBRUSH hbr;
		mutable HPEN hpen;
	};
	std::vector<color_t> m_colors;

	void _DestroyColors ();
};

# endif // __Colors_H_